home *** CD-ROM | disk | FTP | other *** search
/ HyperLib 1997 Winter - Disc 1 / HYPERLIB-1997-Winter-CD1.ISO.7z / HYPERLIB-1997-Winter-CD1.ISO / オンラインウェア / PRG / ICProgKit 1.3.sit / ICProgKit1.3 / Internet Config Source / ICCAPIGlue.p < prev    next >
Text File  |  1996-07-14  |  29KB  |  654 lines

  1. unit ICCAPIGlue;
  2.  
  3. (* ・・・Start Header・・・ *)
  4.  
  5. (* File:         ICCAPI.p (impl)
  6.  * Generated by: 1.0d4
  7.  * For:          IC 1.3
  8.  * On:           Sunday, 14 July 1996, 20:19:55
  9.  * 
  10.  * This file is part of the Internet Configuration system and
  11.  * is placed in the public domain for the benefit of all.
  12.  *)
  13.  
  14. (* ・・・End Header・・・ *)
  15.  
  16. interface
  17.  
  18.     uses
  19. {$ifc undefined THINK_Pascal}
  20.         Types, Files, QuickDraw, AppleTalk, Aliases, 
  21. {$endc}
  22.         Components, ICTypes, ICKeys;
  23.  
  24.     const
  25.         internetConfigurationComponentType = 'PREF';                (* the component type *)
  26.         internetConfigurationComponentSubType = 'ICAp';            (* the component subtype *)
  27.         internetConfigurationComponentInterfaceVersion0 = $00000000;
  28.         internetConfigurationComponentInterfaceVersion1 = $00010000;
  29. (* current version number is version 1 *)
  30.         internetConfigurationComponentInterfaceVersion = internetConfigurationComponentInterfaceVersion1;
  31.  
  32. (* ・・・Start ICCAPI.p・・・ *)
  33.  
  34.   (* ***** Starting Up and Shutting Down ***** *)
  35.   
  36.   function ICCStart(var inst : ComponentInstance; creator : OSType) : ICError;
  37.     (* Call this at application initialisation. Set creator to your application
  38.      * creator to allow for future expansion of the IC system. Returns
  39.      * inst as a connection to the IC system.
  40.      *)
  41.   
  42.   function ICCStop(inst : ComponentInstance) : ICError;
  43.     (* It is illegal to call this routine inside a ICBegin/End pair.
  44.      * Call this at application initialisation, after which inst
  45.      * is no longer valid connection to IC.
  46.      *)
  47.   
  48.   (* ***** Specifying a Configuration ***** *)
  49.   
  50.   function ICCFindConfigFile(inst : ComponentInstance; count : integer; folders : ICDirSpecArrayPtr) : ICError;
  51.   {$ifc not GeneratingCFM}
  52.     inline $2F3C, 6, 2, $7000, $A82A;
  53.   {$endc}
  54.     (* It is illegal to call this routine inside a ICBegin/End pair.
  55.      * Call to configure this connection to IC.
  56.      * Set count as the number of valid elements in folders.
  57.      * Set folders to a pointer to the folders to search.
  58.      * Setting count to 0 and folders to nil is OK.
  59.      * Searches the specified folders and then the Preferences folder
  60.      * in a unspecified manner.
  61.      *)
  62.   
  63.   function ICCFindUserConfigFile(inst : ComponentInstance; var where : ICDirSpec) : ICError;
  64.   {$ifc not GeneratingCFM}
  65.     inline $2F3C, 4, 14, $7000, $A82A;
  66.   {$endc}
  67.     (* Requires IC 1.1.
  68.      * It is illegal to call this routine inside a ICBegin/End pair.
  69.      * Similar to ICFindConfigFile except that it only searches the folder
  70.      * specified in where.  If the input parameters are valid the routine
  71.      * will always successful configure the instance, creating an
  72.      * empty configuration if necessary
  73.      * For use with double-clickable preference files.
  74.      *)
  75.   
  76.   function ICCGeneralFindConfigFile(inst : ComponentInstance; search_prefs : Boolean; can_create : Boolean; count : integer; folders : ICDirSpecArrayPtr) : ICError;
  77.   {$ifc not GeneratingCFM}
  78.     inline $2F3C, 10, 30, $7000, $A82A;
  79.   {$endc}
  80.     (* Requires IC 1.2.
  81.      * It is illegal to call this routine inside a ICBegin/End pair.
  82.      * Call to configure this connection to IC.
  83.      * This routine acts as a more general replacement for
  84.      * ICFindConfigFile and ICFindUserConfigFile.
  85.      * Set search_prefs to true if you want it to search the preferences folder.
  86.      * Set can_create to true if you want it to be able to create a new config.
  87.      * Set count as the number of valid elements in folders.
  88.      * Set folders to a pointer to the folders to search.
  89.      * Setting count to 0 and folders to nil is OK.
  90.      * Searches the specified folders and then optionally the Preferences folder
  91.      * in a unspecified manner.
  92.      *)
  93.   
  94.   function ICCChooseConfig(inst : ComponentInstance) : ICError;
  95.   {$ifc not GeneratingCFM}
  96.     inline $2F3C, 0, 33, $7000, $A82A;
  97.   {$endc}
  98.     (* Requires IC 1.2.
  99.      * It is illegal to call this routine inside a ICBegin/End pair.
  100.      * Requests the user to choose a configuration, typically using some
  101.      * sort of modal dialog. If the user cancels the dialog the configuration
  102.      * state will be unaffected.
  103.      *)
  104.   
  105.   function ICCChooseNewConfig(inst : ComponentInstance) : ICError;
  106.   {$ifc not GeneratingCFM}
  107.     inline $2F3C, 0, 34, $7000, $A82A;
  108.   {$endc}
  109.     (* Requires IC 1.2.
  110.      * It is illegal to call this routine inside a ICBegin/End pair.
  111.      * Requests the user to create a new configuration, typically using some
  112.      * sort of modal dialog. If the user cancels the dialog the configuration
  113.      * state will be unaffected.
  114.      *)
  115.   
  116.   function ICCGetConfigName(inst : ComponentInstance; longname : Boolean; var name : Str255) : ICError;
  117.   {$ifc not GeneratingCFM}
  118.     inline $2F3C, 6, 35, $7000, $A82A;
  119.   {$endc}
  120.     (* Requires IC 1.2.
  121.      * You must specify a configuration before calling this routine.
  122.      * Returns a string that describes the current configuration at a user
  123.      * level. Set longname to true if you want a long name, up to 255
  124.      * characters, or false if you want a short name, typically about 32
  125.      * characters.
  126.      * The returned string is for user display only. If you rely on the
  127.      * exact format of it, you will conflict with any future IC
  128.      * implementation that doesn't use explicit preference files.
  129.      *)
  130.   
  131.   function ICCGetConfigReference(inst : ComponentInstance; ref : ICConfigRefHandle) : ICError;
  132.   {$ifc not GeneratingCFM}
  133.     inline $2F3C, 4, 31, $7000, $A82A;
  134.   {$endc}
  135.     (* Requires IC 1.2.
  136.      * You must specify a configuration before calling this routine.
  137.      * Returns a self-contained reference to the instance's current
  138.      * configuration.
  139.      * ref must be a valid non-nil handle and it will be resized to fit the
  140.      * resulting data.
  141.      *)
  142.   
  143.   function ICCSetConfigReference(inst : ComponentInstance; ref : ICConfigRefHandle; flags : longint) : ICError;
  144.   {$ifc not GeneratingCFM}
  145.     inline $2F3C, 8, 32, $7000, $A82A;
  146.   {$endc}
  147.     (* Requires IC 1.2.
  148.      * It is illegal to call this routine inside a ICBegin/End pair.
  149.      * Reconfigures the instance using a configuration reference that was
  150.      * got using ICGetConfigReference reference. Set the
  151.      * icNoUserInteraction_bit in flags if you require that this routine
  152.      * not present a modal dialog. Other flag bits are reserved and should
  153.      * be set to zero.
  154.      * ref must not be nil.
  155.      *)
  156.   
  157.   function ICCSpecifyConfigFile(inst : ComponentInstance; var config : FSSpec) : ICError;
  158.   {$ifc not GeneratingCFM}
  159.     inline $2F3C, 4, 3, $7000, $A82A;
  160.   {$endc}
  161.     (* It is illegal to call this routine inside a ICBegin/End pair.
  162.      * For use only by the IC application.
  163.      * If you call this routine yourself, you will conflict with any
  164.      * future IC implementation that doesn't use explicit preference files.
  165.      *)
  166.   
  167.   (* ***** Getting Information ***** *)
  168.   
  169.   function ICCGetSeed(inst : ComponentInstance; var seed : longint) : ICError;
  170.   {$ifc not GeneratingCFM}
  171.     inline $2F3C, 4, 4, $7000, $A82A;
  172.   {$endc}
  173.     (* You do not have to specify a configuration before calling this routine.
  174.      * You do not have to be inside an ICBegin/End pair to call this routine.
  175.      * Returns the current seed for the IC prefs database.
  176.      * This seed changes each time a non-volatile preference is changed.
  177.      * You can poll this to determine if any cached preferences change.
  178.      *)
  179.   
  180.   function ICCGetPerm(inst : ComponentInstance; var perm : ICPerm) : ICError;
  181.   {$ifc not GeneratingCFM}
  182.     inline $2F3C, 4, 13, $7000, $A82A;
  183.   {$endc}
  184.     (* You do not have to specify a configuration before calling this routine.
  185.      * Returns the access permissions currently associated with this instance.
  186.      * While applications normally know what permissions they have,
  187.      * this routine is designed for use by override components.
  188.      *)
  189.   
  190.   function ICCDefaultFileName(inst : ComponentInstance; var name : Str63) : ICError;
  191.   {$ifc not GeneratingCFM}
  192.     inline $2F3C, 4, 11, $7000, $A82A;
  193.   {$endc}
  194.     (* You do not have to specify a configuration before calling this routine.
  195.      * You do not have to be inside an ICBegin/End pair to call this routine.
  196.      * Returns the default file name for IC preference files.
  197.      * Applications should never need to call this routine.
  198.      * If you rely on information returned by this routine yourself,
  199.      * you may conflict with any future IC implementation that doesn't use
  200.      * explicit preference files.
  201.      * The component calls this routine to set up the default IC file name.
  202.      * This allows this operation to be intercepted by a component that has
  203.      * captured us. It currently gets it from the component resource file.
  204.      * The glue version is hardwired to "Internet Preferences".
  205.      *)
  206.   
  207.   (* ***** Reading and Writing Preferences ***** *)
  208.   
  209.   function ICCBegin(inst : ComponentInstance; perm : ICPerm) : ICError;
  210.   {$ifc not GeneratingCFM}
  211.     inline $2F3C, 2, 5, $7000, $A82A;
  212.   {$endc}
  213.     (* You must specify a configuration before calling this routine.
  214.      * It is illegal to call this routine inside a ICBegin/End pair.
  215.      * Starting reading or writing multiple preferences.
  216.      * A call to this must be balanced by a call to ICEnd.
  217.      * Do not call WaitNextEvent between these calls.
  218.      * The perm specifies whether you intend to read or read/write.
  219.      * Only one writer is allowed per instance.
  220.      * Note that this may open resource files that are not closed
  221.      * until you call ICEnd.
  222.      *)
  223.   
  224.   function ICCGetPref(inst : ComponentInstance; key : Str255; var attr : ICAttr; buf : Ptr; var size : longint) : ICError;
  225.   {$ifc not GeneratingCFM}
  226.     inline $2F3C, 16, 6, $7000, $A82A;
  227.   {$endc}
  228.     (* You must specify a configuration before calling this routine.
  229.      * If you are getting or setting multiple preferences, you should place
  230.      * these calls within an ICBegin/ICEnd pair.
  231.      * If you call this routine outside of such a pair, it implicitly
  232.      * calls ICBegin(inst, icReadOnlyPerm).
  233.      * Reads the preference specified by key from the IC database to the
  234.      * buffer pointed to by buf and size.
  235.      * key must not be the empty string.
  236.      * If buf is nil then no data is returned.
  237.      * size must be non-negative.
  238.      * attr and size are always set on return. On errors (except icTruncatedErr)
  239.      * attr is set to ICattr_no_change and size is set to 0.
  240.      * size is the actual size of the data.
  241.      * attr is set to the attributes associated with the preference.
  242.      * If this routine returns icTruncatedErr then the other returned
  243.      * values are valid except that only the first size bytes have been
  244.      * return. size is adjusted to reflect the true size of the preference.
  245.      * Returns icPrefNotFound if there is no preference for the key.
  246.      *)
  247.   
  248.   function ICCSetPref(inst : ComponentInstance; key : Str255; attr : ICAttr; buf : Ptr; size : longint) : ICError;
  249.   {$ifc not GeneratingCFM}
  250.     inline $2F3C, 16, 7, $7000, $A82A;
  251.   {$endc}
  252.     (* You must specify a configuration before calling this routine.
  253.      * If you are getting or setting multiple preferences, you should place
  254.      * these calls within an ICBegin/ICEnd pair.
  255.      * If you call this routine outside of such a pair, it implicitly
  256.      * calls ICBegin(inst, icReadWritePerm).
  257.      * Sets the preference specified by key from the IC database to the
  258.      * value pointed to by buf and size.
  259.      * key must not be the empty string.
  260.      * size must be non-negative. 
  261.      * If buf is nil then the preference value is not set and size is ignored.
  262.      * If buf is not nil then the preference value is set to the size
  263.      * bytes pointed to by buf.
  264.      * If attr is ICattr_no_change then the preference attributes are not set.
  265.      * Otherwise the preference attributes are set to attr.
  266.      * Returns icPermErr if the previous ICBegin was passed icReadOnlyPerm.
  267.      * Returns icPermErr if current attr is locked, new attr is locked and buf <> nil.
  268.      *)
  269.   
  270.   function ICCFindPrefHandle(inst : ComponentInstance; key : Str255; var attr : ICAttr; prefh : Handle) : ICError;
  271.   {$ifc not GeneratingCFM}
  272.     inline $2F3C, 12, 36, $7000, $A82A;
  273.   {$endc}
  274.     (* Requires IC 1.2.
  275.      * You must specify a configuration before calling this routine.
  276.      * If you are getting or setting multiple preferences, you should place
  277.      * these calls within an ICBegin/ICEnd pair.
  278.      * If you call this routine outside of such a pair, it implicitly
  279.      * calls ICBegin(inst, icReadWritePerm).
  280.      * This routine effectively replaces ICGetPrefHandle.
  281.      * Reads the preference specified by key from the IC database into
  282.      * a handle, prefh.
  283.      * key must not be the empty string.
  284.      * attr is set to the attributes associated with the preference.
  285.      * You must set prefh to a non-nil handle before calling this routine.
  286.      * If the preference does not exist, icPrefNotFoundErr is returned.
  287.      *)
  288.   
  289.   function ICCGetPrefHandle(inst : ComponentInstance; key : Str255; var attr : ICAttr; var prefh : Handle) : ICError;
  290.   {$ifc not GeneratingCFM}
  291.     inline $2F3C, 12, 26, $7000, $A82A;
  292.   {$endc}
  293.     (* Requires IC 1.1.
  294.      * You must specify a configuration before calling this routine.
  295.      * If you are getting or setting multiple preferences, you should place
  296.      * these calls within an ICBegin/ICEnd pair.
  297.      * If you call this routine outside of such a pair, it implicitly
  298.      * calls ICBegin(inst, icReadOnlyPerm).
  299.      * This routine is now obsolete. Use ICFindPrefHandle instead.
  300.      * Reads the preference specified by key from the IC database into
  301.      * a newly created handle, prefh.
  302.      * key must not be the empty string.
  303.      * attr is set to the attributes associated with the preference.
  304.      * The incoming value of prefh is ignored.
  305.      * A new handle is created in the current heap and returned in prefh.
  306.      * If the routine returns an error, prefh is set to nil.
  307.      * If the preference does not exist, no error is returned and prefh is set
  308.      * to an empty handle.
  309.      *)
  310.   
  311.   function ICCSetPrefHandle(inst : ComponentInstance; key : Str255; attr : ICAttr; prefh : Handle) : ICError;
  312.   {$ifc not GeneratingCFM}
  313.     inline $2F3C, 12, 27, $7000, $A82A;
  314.   {$endc}
  315.     (* Requires IC 1.1.
  316.      * You must specify a configuration before calling this routine.
  317.      * If you are getting or setting multiple preferences, you should place
  318.      * these calls within an ICBegin/ICEnd pair.
  319.      * If you call this routine outside of such a pair, it implicitly
  320.      * calls ICBegin(inst, icReadWritePerm).
  321.      * Sets the preference specified by key from the IC database to the
  322.      * value contained in prefh.
  323.      * key must not be the empty string.
  324.      * If prefh is nil then the preference value is not set.
  325.      * If buf is not nil then the preference value is set to the data
  326.      * contained in it.
  327.      * If attr is ICattr_no_change then the preference attributes are not set.
  328.      * Otherwise the preference attributes are set to attr.
  329.      * Returns icPermErr if the previous ICBegin was passed icReadOnlyPerm.
  330.      * Returns icPermErr if current attr is locked, new attr is locked and prefh <> nil.
  331.      *)
  332.   
  333.   function ICCCountPref(inst : ComponentInstance; var count : longint) : ICError;
  334.   {$ifc not GeneratingCFM}
  335.     inline $2F3C, 4, 8, $7000, $A82A;
  336.   {$endc}
  337.     (* You must specify a configuration before calling this routine.
  338.      * You must be inside an ICBegin/End pair to call this routine.
  339.      * Counts the total number of preferences.
  340.      * If the routine returns an error, count is set to 0.
  341.      *)
  342.   
  343.   function ICCGetIndPref(inst : ComponentInstance; n : longint; var key : Str255) : ICError;
  344.   {$ifc not GeneratingCFM}
  345.     inline $2F3C, 8, 9, $7000, $A82A;
  346.   {$endc}
  347.     (* You must specify a configuration before calling this routine.
  348.      * You must be inside an ICBegin/End pair to call this routine.
  349.      * Returns the key of the Nth preference.
  350.      * n must be positive.
  351.      * Returns icPrefNotFoundErr if n is greater than the total number of preferences.
  352.      * If the routine returns an error, key is undefined.
  353.      *)
  354.   
  355.   function ICCDeletePref(inst : ComponentInstance; key : Str255) : ICError;
  356.   {$ifc not GeneratingCFM}
  357.     inline $2F3C, 4, 12, $7000, $A82A;
  358.   {$endc}
  359.     (* You must specify a configuration before calling this routine.
  360.      * You must be inside an ICBegin/End pair to call this routine.
  361.      * Deletes the preference specified by key.
  362.      * key must not be the empty string.
  363.      * Returns icPrefNotFound if the preference specified by key is not present.
  364.      *)
  365.   
  366.   function ICCEnd(inst : ComponentInstance) : ICError;
  367.   {$ifc not GeneratingCFM}
  368.     inline $2F3C, 0, 10, $7000, $A82A;
  369.   {$endc}
  370.     (* You must specify a configuration before calling this routine.
  371.      * You must be inside an ICBegin/End pair to call this routine.
  372.      * Terminates a preference session, as started by ICBegin.
  373.      * You must have called ICBegin before calling this routine.
  374.      *)
  375.   
  376.   (* ***** User Interface Stuff ***** *)
  377.   
  378.   function ICCEditPreferences(inst : ComponentInstance; key : Str255) : ICError;
  379.   {$ifc not GeneratingCFM}
  380.     inline $2F3C, 4, 15, $7000, $A82A;
  381.   {$endc}
  382.     (* Requires IC 1.1.
  383.      * You must specify a configuration before calling this routine.
  384.      * You do not have to be inside an ICBegin/End pair to call this routine.
  385.      * Instructs IC to display the user interface associated with editing
  386.      * preferences and focusing on the preference specified by key.
  387.      * If key is the empty string then no preference should be focused upon.
  388.      * You must have specified a configuration before calling this routine.
  389.      * You do not need to call ICBegin before calling this routine.
  390.      * In the current implementation this launches the IC application
  391.      * (or brings it to the front) and displays the window containing
  392.      * the preference specified by key.
  393.      * It may have a radically different implementation in future
  394.      * IC systems.
  395.      *)
  396.   
  397.   (* ***** URL Handling ***** *)
  398.   
  399.   function ICCParseURL(inst : ComponentInstance; hint : Str255; data : Ptr; len : longint; var selStart : longint; var selEnd : longint; url : Handle) : ICError;
  400.   {$ifc not GeneratingCFM}
  401.     inline $2F3C, 24, 16, $7000, $A82A;
  402.   {$endc}
  403.     (* Requires IC 1.1.
  404.      * You must specify a configuration before calling this routine.
  405.      * You do not have to be inside an ICBegin/End pair to call this routine.
  406.      * Parses a URL out of the specified text and returns it in a canonical form
  407.      * in a handle.
  408.      * hint indicates the default scheme for URLs of the form "name@address".
  409.      * If hint is the empty string then URLs of that form are not allowed.
  410.      * data points to the start of the text. It must not be nil.
  411.      * len indicates the length of the text. It must be non-negative.
  412.      * selStart and selEnd should be passed in as the current selection of
  413.      * the text. This selection is given in the same manner as TextEdit,
  414.      * ie if selStart = selEnd then there is no selection only an insertion
  415.      * point. Also selStart イ selEnd and 0 イ selStart イ len and 0 イ selEnd イ len.
  416.      * selStart and selEnd are returned as the bounds of the URL. If the
  417.      * routine returns an error then these new boundaries may be
  418.      * invalid but they will be close.
  419.      * The incoming url handle must not be nil.  The resulting URL is normalised
  420.      * and copied into the url handle, which is resized to fit.
  421.      *)
  422.   
  423.   function ICCLaunchURL(inst : ComponentInstance; hint : Str255; data : Ptr; len : longint; var selStart : longint; var selEnd : longint) : ICError;
  424.   {$ifc not GeneratingCFM}
  425.     inline $2F3C, 20, 17, $7000, $A82A;
  426.   {$endc}
  427.     (* Requires IC 1.1.
  428.      * You must specify a configuration before calling this routine.
  429.      * You do not have to be inside an ICBegin/End pair to call this routine.
  430.      * Parses a URL out of the specified text and feeds it off to the
  431.      * appropriate helper.
  432.      * hint indicates the default scheme for URLs of the form "name@address".
  433.      * If hint is the empty string then URLs of that form are not allowed.
  434.      * data points to the start of the text. It must not be nil.
  435.      * len indicates the length of the text. It must be non-negative.
  436.      * selStart and selEnd should be passed in as the current selection of
  437.      * the text. This selection is given in the same manner as TextEdit,
  438.      * ie if selStart = selEnd then there is no selection only an insertion
  439.      * point. Also selStart イ selEnd and 0 イ selStart イ len and 0 イ selEnd イ len.
  440.      * selStart and selEnd are returned as the bounds of the URL. If the
  441.      * routine returns an error then these new boundaries may be
  442.      * invalid but they will be close.
  443.      * The URL is parsed out of the text and passed off to the appropriate
  444.      * helper using the GURL AppleEvent.
  445.      *)
  446.   
  447.   (* ***** Mappings Routines *****
  448.    * 
  449.    * Routines for interrogating mappings database.
  450.    * 
  451.    * ----- High Level Routines -----
  452.    *)
  453.   
  454.   function ICCMapFilename(inst : ComponentInstance; filename : Str255; var entry : ICMapEntry) : ICError;
  455.   {$ifc not GeneratingCFM}
  456.     inline $2F3C, 8, 24, $7000, $A82A;
  457.   {$endc}
  458.     (* Requires IC 1.1.
  459.      * You must specify a configuration before calling this routine.
  460.      * If you are getting or setting multiple preferences, you should place
  461.      * these calls within an ICBegin/ICEnd pair.
  462.      * If you call this routine outside of such a pair, it implicitly
  463.      * calls ICBegin(inst, icReadWritePerm).
  464.      * Takes the name of an incoming file and returns the most appropriate
  465.      * mappings database entry, based on its extension.
  466.      * filename must not be the empty string.
  467.      * Returns icPrefNotFoundErr if no suitable entry is found.
  468.      *)
  469.   
  470.   function ICCMapTypeCreator(inst : ComponentInstance; fType : OSType; fCreator : OSType; filename : Str255; var entry : ICMapEntry) : ICError;
  471.   {$ifc not GeneratingCFM}
  472.     inline $2F3C, 16, 25, $7000, $A82A;
  473.   {$endc}
  474.     (* Requires IC 1.1.
  475.      * You must specify a configuration before calling this routine.
  476.      * You must be inside an ICBegin/End pair to call this routine.
  477.      * Takes the type and creator (and optionally the name) of an outgoing
  478.      * file and returns the most appropriate mappings database entry.
  479.      * The filename may be either the name of the outgoing file or
  480.      * the empty string.
  481.      * Returns icPrefNotFoundErr if no suitable entry found.
  482.      *)
  483.   
  484.   (* ----- Mid Level Routines ----- *)
  485.   
  486.   function ICCMapEntriesFilename(inst : ComponentInstance; entries : Handle; filename : Str255; var entry : ICMapEntry) : ICError;
  487.   {$ifc not GeneratingCFM}
  488.     inline $2F3C, 12, 28, $7000, $A82A;
  489.   {$endc}
  490.     (* Requires IC 1.1.
  491.      * You must specify a configuration before calling this routine.
  492.      * You do not have to be inside an ICBegin/End pair to call this routine.
  493.      * Takes the name of an incoming file and returns the most appropriate
  494.      * mappings database entry, based on its extension.
  495.      * entries must be a handle to a valid IC mappings database preference.
  496.      * filename must not be the empty string.
  497.      * Returns icPrefNotFoundErr if no suitable entry is found.
  498.      *)
  499.   
  500.   function ICCMapEntriesTypeCreator(inst : ComponentInstance; entries : Handle; fType : OSType; fCreator : OSType; filename : Str255; var entry : ICMapEntry) : ICError;
  501.   {$ifc not GeneratingCFM}
  502.     inline $2F3C, 20, 29, $7000, $A82A;
  503.   {$endc}
  504.     (* Requires IC 1.1.
  505.      * You must specify a configuration before calling this routine.
  506.      * You do not have to be inside an ICBegin/End pair to call this routine.
  507.      * Takes the type and creator (and optionally the name) of an outgoing
  508.      * file and returns the most appropriate mappings database entry.
  509.      * entries must be a handle to a valid IC mappings database preference.
  510.      * The filename may be either the name of the outgoing file or
  511.      * the empty string.
  512.      * Returns icPrefNotFoundErr if no suitable entry found.
  513.      *)
  514.   
  515.   (* ----- Low Level Routines ----- *)
  516.   
  517.   function ICCCountMapEntries(inst : ComponentInstance; entries : Handle; var count : longint) : ICError;
  518.   {$ifc not GeneratingCFM}
  519.     inline $2F3C, 8, 18, $7000, $A82A;
  520.   {$endc}
  521.     (* Requires IC 1.1.
  522.      * You must specify a configuration before calling this routine.
  523.      * You do not have to be inside an ICBegin/End pair to call this routine.
  524.      * Counts the number of entries in the mappings database.
  525.      * entries must be a handle to a valid IC mappings database preference.
  526.      * count is set to the number of entries.
  527.      *)
  528.   
  529.   function ICCGetIndMapEntry(inst : ComponentInstance; entries : Handle; ndx : longint; var pos : longint; var entry : ICMapEntry) : ICError;
  530.   {$ifc not GeneratingCFM}
  531.     inline $2F3C, 16, 19, $7000, $A82A;
  532.   {$endc}
  533.     (* Requires IC 1.1.
  534.      * You must specify a configuration before calling this routine.
  535.      * You do not have to be inside an ICBegin/End pair to call this routine.
  536.      * Gets the ndx'th entry in the mappings database.
  537.      * entries must be a handle to a valid IC mappings database preference.
  538.      * ndx must be in the range from 1 to the number of entries in the database.
  539.      * The value of pos is ignored on input. pos is set to the position of
  540.      * the ndx'th entry in the database and is suitable for passing back
  541.      * into ICSetMapEntry.
  542.      * Does not return any user data associated with the entry.
  543.      *)
  544.   
  545.   function ICCGetMapEntry(inst : ComponentInstance; entries : Handle; pos : longint; var entry : ICMapEntry) : ICError;
  546.   {$ifc not GeneratingCFM}
  547.     inline $2F3C, 12, 20, $7000, $A82A;
  548.   {$endc}
  549.     (* Requires IC 1.1.
  550.      * You must specify a configuration before calling this routine.
  551.      * You do not have to be inside an ICBegin/End pair to call this routine.
  552.      * Returns the entry located at position pos in the mappings database.
  553.      * entries must be a handle to a valid IC mappings database preference.
  554.      * pos should be 0 to get the first entry. To get the subsequent entries, add
  555.      * entry.total_size to pos and iterate.
  556.      * Does not return any user data associated with the entry.
  557.      *)
  558.   
  559.   function ICCSetMapEntry(inst : ComponentInstance; entries : Handle; pos : longint; var entry : ICMapEntry) : ICError;
  560.   {$ifc not GeneratingCFM}
  561.     inline $2F3C, 12, 21, $7000, $A82A;
  562.   {$endc}
  563.     (* Requires IC 1.1.
  564.      * You must specify a configuration before calling this routine.
  565.      * You do not have to be inside an ICBegin/End pair to call this routine.
  566.      * Sets the entry located at position pos in the mappings database.
  567.      * entries must be a handle to a valid IC mappings database preference.
  568.      * pos should be either a value returned from ICGetIndMapEntry or a value
  569.      * calculated using ICGetMapEntry.
  570.      * entry is a var parameter purely for stack space reasons. It is not
  571.      * modified in any way.
  572.      * Any user data associated with the entry is unmodified.
  573.      *)
  574.   
  575.   function ICCDeleteMapEntry(inst : ComponentInstance; entries : Handle; pos : longint) : ICError;
  576.   {$ifc not GeneratingCFM}
  577.     inline $2F3C, 8, 22, $7000, $A82A;
  578.   {$endc}
  579.     (* Requires IC 1.1.
  580.      * You must specify a configuration before calling this routine.
  581.      * You do not have to be inside an ICBegin/End pair to call this routine.
  582.      * Deletes the mappings database entry at pos.
  583.      * entries must be a handle to a valid IC mappings database preference.
  584.      * pos should be either a value returned from ICGetIndMapEntry or a value
  585.      * calculated using ICGetMapEntry.
  586.      * Also deletes any user data associated with the entry.
  587.      *)
  588.   
  589.   function ICCAddMapEntry(inst : ComponentInstance; entries : Handle; var entry : ICMapEntry) : ICError;
  590.   {$ifc not GeneratingCFM}
  591.     inline $2F3C, 8, 23, $7000, $A82A;
  592.   {$endc}
  593.     (* Requires IC 1.1.
  594.      * You must specify a configuration before calling this routine.
  595.      * You do not have to be inside an ICBegin/End pair to call this routine.
  596.      * Adds an entry to the mappings database.
  597.      * entries must be a handle to a valid IC mappings database preference.
  598.      * The entry is added to the end of the entries database.
  599.      * No user data is added.
  600.      *)
  601.   
  602.  
  603. (* ・・・End ICCAPI.p・・・ *)
  604.  
  605. implementation
  606.  
  607. {$ifc undefined THINK_Pascal}
  608.     uses
  609.         GestaltEqu;
  610. {$endc}
  611.  
  612.     function ICCStartComponent (inst: ComponentInstance; creator: OSType): ICError;
  613.     inline
  614.         $2F3C, 4, 0, $7000, $A82A;
  615.     function ICCStopComponent (inst: ComponentInstance): ICError;
  616.     inline
  617.         $2F3C, 0, 1, $7000, $A82A;
  618.  
  619.     function ICCStart (var inst: ComponentInstance; creator: OSType): ICError;
  620.         var
  621.             err, junk: ICError;
  622.             response: longint;
  623.     begin
  624.         inst := nil;
  625.         if Gestalt(gestaltComponentMgr, response) = noErr then begin
  626.             inst := OpenDefaultComponent(internetConfigurationComponentType, internetConfigurationComponentSubType);
  627.         end; (* if *)
  628.         if inst = nil then begin
  629.             err := badComponentInstance;
  630.         end
  631.         else begin
  632.             err := ICCStartComponent(inst, creator);
  633.             if err <> noErr then begin
  634.                 junk := CloseComponent(inst);
  635.                 inst := nil;
  636.             end; (* if *)
  637.         end; (* if *)
  638.         ICCStart := err;
  639.     end; (* ICCStart *)
  640.  
  641.     function ICCStop (inst: ComponentInstance): ICError;
  642.         var
  643.             err, err2: ICError;
  644.     begin
  645.         err := ICCStopComponent(inst);
  646.         err2 := CloseComponent(inst);
  647.         if err = noErr then begin
  648.             err := err2;
  649.         end; (* if *)
  650.         ICCStop := err;
  651.     end; (* ICCStop *)
  652.  
  653. end. (* ICCAPIGlue *)
  654.